#!/usr/bin/env python
# -*- coding:utf-8 -*-
from Queue  import Queue
from contrib import lib
class WorkQueue():
    def __init__(self):
        self.queue = Queue()
        self.visited = set()
        pass
        
    def add(self, url):
        urlmd5 = lib.md5(url)
        if urlmd5 not in self.visited:
            self.visited.add(urlmd5)
            self.queue.put(url)
            
    def checkIn(self, url):
        urlmd5 = lib.md5(url)
        return urlmd5 in self.visited
    
    def get(self):
        return self.queue.get()
    def empty(self):
        return self.queue.empty()
    
if __name__ == '__main__':
    pass
    queue = WorkQueue()